Question: Hey, I need help editing my code to match the requirements for this STm 3 2 ( C coding language project ) . Below on

Hey, I need help editing my code to match the requirements for this STm32(C coding language project). Below on my code, I have LED0 and LED1 blinking with the required HZ and seconds but need help reorganizing it. I'll attach below the requirements and my code below.
CODE:
#include "main.h" TIM_HandleTypeDef htim6; TIM_HandleTypeDef htim7; void SystemClock_Config(void); static void MX_GPIO_Init(void); static void MX_TIM6_Init(void); static void MX_TIM7_Init(void); int main(void){ HAL_Init(); SystemClock_Config(); MX_GPIO_Init(); MX_TIM6_Init(); MX_TIM7_Init(); HAL_TIM_Base_Start_IT(&htim6); HAL_TIM_Base_Start_IT(&htim7); while (1){}} void SystemClock_Config(void){ RCC_OscInitTypeDef RCC_OscInitStruct ={0}; RCC_ClkInitTypeDef RCC_ClkInitStruct ={0}; __HAL_RCC_PWR_CLK_ENABLE(); __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE3); RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; RCC_OscInitStruct.HSIState = RCC_HSI_ON; RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT; RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; RCC_OscInitStruct.PLL.PLLM =16; RCC_OscInitStruct.PLL.PLLN =336; RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; RCC_OscInitStruct.PLL.PLLQ =2; RCC_OscInitStruct.PLL.PLLR =2; if (HAL_RCC_OscConfig(&RCC_OscInitStruct)!= HAL_OK){ Error_Handler(); } RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2)!= HAL_OK){ Error_Handler(); }} static void MX_TIM6_Init(void){ TIM_MasterConfigTypeDef sMasterConfig ={0}; htim6.Instance = TIM6; htim6.Init.Prescaler =47999; htim6.Init.CounterMode = TIM_COUNTERMODE_UP; htim6.Init.Period =499; htim6.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim6)!= HAL_OK){ Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim6, &sMasterConfig)!= HAL_OK){ Error_Handler(); }} static void MX_TIM7_Init(void){ TIM_MasterConfigTypeDef sMasterConfig ={0}; htim7.Instance = TIM7; htim7.Init.Prescaler =47999; htim7.Init.CounterMode = TIM_COUNTERMODE_UP; htim7.Init.Period =999; htim7.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE; if (HAL_TIM_Base_Init(&htim7)!= HAL_OK){ Error_Handler(); } sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET; sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE; if (HAL_TIMEx_MasterConfigSynchronization(&htim7, &sMasterConfig)!= HAL_OK){ Error_Handler(); }} static void MX_GPIO_Init(void){ GPIO_InitTypeDef GPIO_InitStruct ={0}; /* GPIO Ports Clock Enable */__HAL_RCC_GPIOC_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOA, GPIO_PIN_5, GPIO_PIN_RESET); /*Configure GPIO pin Output Level */ HAL_GPIO_WritePin(GPIOC, GPIO_PIN_4, GPIO_PIN_RESET); /*Configure GPIO pin : PC13*/ GPIO_InitStruct.Pin = GPIO_PIN_13; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /*Configure GPIO pin : PA5*/ GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pins : PA6 PA7*/ GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); /*Configure GPIO pin : PC4*/ GPIO_InitStruct.Pin = GPIO_PIN_4; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); /* EXTI interrupt init*/ HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0,0); HAL_NVIC_EnableIRQ(EXTI9_5_IRQn); HAL_NVIC_SetPriority(EXTI15_10_IRQn, 0,0); HAL_NVIC_EnableIRQ(EXTI15_10_IRQn); /* USER CODE BEGIN MX_GPIO_Init_2*//* USER CODE END MX_GPIO_Init_2*/}/* Declare static integers */ static int timerstatus =0; static int timerstatus1=0; /*Function called every time he counter fishes*/ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){/*If timer status is 1, blink*/ if(timerstatus ==1)
Hey, I need help editing my code to match the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!