diff --git a/RTC/Core/Inc/main.h b/RTC/Core/Inc/main.h index f033501..63489cf 100644 --- a/RTC/Core/Inc/main.h +++ b/RTC/Core/Inc/main.h @@ -70,14 +70,14 @@ void Error_Handler(void); #define USART_TX_GPIO_Port GPIOA #define USART_RX_Pin GPIO_PIN_3 #define USART_RX_GPIO_Port GPIOA -#define LD2_Pin GPIO_PIN_5 -#define LD2_GPIO_Port GPIOA +//#define LD2_Pin GPIO_PIN_5 +//#define LD2_GPIO_Port GPIOA #define TMS_Pin GPIO_PIN_13 #define TMS_GPIO_Port GPIOA #define TCK_Pin GPIO_PIN_14 #define TCK_GPIO_Port GPIOA -#define SWO_Pin GPIO_PIN_3 -#define SWO_GPIO_Port GPIOB +//#define SWO_Pin GPIO_PIN_3 +//#define SWO_GPIO_Port GPIOB /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ diff --git a/RTC/Core/Src/main.c b/RTC/Core/Src/main.c index d190487..d5525e2 100644 --- a/RTC/Core/Src/main.c +++ b/RTC/Core/Src/main.c @@ -424,20 +424,7 @@ int main(void) HAL_Init(); /* USER CODE BEGIN Init */ - //----- Init of the Motor control library - /* Set the L6208 library to use 1 device */ - BSP_MotorControl_SetNbDevices(BSP_MOTOR_CONTROL_BOARD_ID_L6208, 1); - BSP_MotorControl_Init(BSP_MOTOR_CONTROL_BOARD_ID_L6208, NULL); - /* Attach the function MyFlagInterruptHandler (defined below) to the flag interrupt */ - BSP_MotorControl_AttachFlagInterrupt(MyFlagInterruptHandler); - /* Attach the function MyErrorHandler (defined below) to the error Handler*/ - BSP_MotorControl_AttachErrorHandler(Error_Handler); - /* Set Systick Interrupt priority highest to ensure no lock by using HAL_Delay */ - HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0); - /* Configure KEY Button */ - BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); - /* Disable the power bridges after initialization */ - BSP_MotorControl_CmdDisable(0); + /* USER CODE END Init */ /* Configure the system clock */ @@ -453,6 +440,21 @@ int main(void) MX_RTC_Init(); /* USER CODE BEGIN 2 */ + //----- Init of the Motor control library + /* Set the L6208 library to use 1 device */ + BSP_MotorControl_SetNbDevices(BSP_MOTOR_CONTROL_BOARD_ID_L6208, 1); + BSP_MotorControl_Init(BSP_MOTOR_CONTROL_BOARD_ID_L6208, NULL); + /* Attach the function MyFlagInterruptHandler (defined below) to the flag interrupt */ + BSP_MotorControl_AttachFlagInterrupt(MyFlagInterruptHandler); + /* Attach the function MyErrorHandler (defined below) to the error Handler*/ + BSP_MotorControl_AttachErrorHandler(Error_Handler); + /* Set Systick Interrupt priority highest to ensure no lock by using HAL_Delay */ + HAL_NVIC_SetPriority(SysTick_IRQn, 0x0, 0x0); + /* Configure KEY Button */ + BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_EXTI); + /* Disable the power bridges after initialization */ + BSP_MotorControl_CmdDisable(0); + timeAndDate sunrise, sunset, wakeUpTimeForStep, tomorrowsDate, initialDate; sunrise = sunset = wakeUpTimeForStep = tomorrowsDate = initialDate = (timeAndDate) {\ 0, @@ -566,7 +568,8 @@ void SystemClock_Config(void) */ RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; - RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + //RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; + RCC_OscInitStruct.HSICalibrationValue = 16; RCC_OscInitStruct.LSIState = RCC_LSI_ON; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; @@ -738,7 +741,7 @@ static void MX_GPIO_Init(void) __HAL_RCC_GPIOB_CLK_ENABLE(); /*Configure GPIO pin Output Level */ - HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET); + //HAL_GPIO_WritePin(LD2_GPIO_Port, LD2_Pin, GPIO_PIN_RESET); /*Configure GPIO pin : B1_Pin */ GPIO_InitStruct.Pin = B1_Pin; @@ -747,11 +750,11 @@ static void MX_GPIO_Init(void) HAL_GPIO_Init(B1_GPIO_Port, &GPIO_InitStruct); /*Configure GPIO pin : LD2_Pin */ - GPIO_InitStruct.Pin = LD2_Pin; + //GPIO_InitStruct.Pin = LD2_Pin; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; - HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct); + //HAL_GPIO_Init(LD2_GPIO_Port, &GPIO_InitStruct); }