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 STmC coding language project Below on my code, I have LED and LED 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 TIMHandleTypeDef htim; TIMHandleTypeDef htim; void SystemClockConfigvoid; static void MXGPIOInitvoid; static void MXTIMInitvoid; static void MXTIMInitvoid; int mainvoid HALInit; SystemClockConfig; MXGPIOInit; MXTIMInit; MXTIMInit; HALTIMBaseStartIT&htim; HALTIMBaseStartIT&htim; while void SystemClockConfigvoid RCCOscInitTypeDef RCCOscInitStruct ; RCCClkInitTypeDef RCCClkInitStruct ; HALRCCPWRCLKENABLE; HALPWRVOLTAGESCALINGCONFIGPWRREGULATORVOLTAGESCALE; RCCOscInitStruct.OscillatorType RCCOSCILLATORTYPEHSI; RCCOscInitStruct.HSIState RCCHSION; RCCOscInitStruct.HSICalibrationValue RCCHSICALIBRATIONDEFAULT; RCCOscInitStruct.PLLPLLState RCCPLLON; RCCOscInitStruct.PLLPLLSource RCCPLLSOURCEHSI; RCCOscInitStruct.PLLPLLM ; RCCOscInitStruct.PLLPLLN ; RCCOscInitStruct.PLLPLLP RCCPLLPDIV; RCCOscInitStruct.PLLPLLQ ; RCCOscInitStruct.PLLPLLR ; if HALRCCOscConfig&RCCOscInitStruct HALOK ErrorHandler; RCCClkInitStruct.ClockType RCCCLOCKTYPEHCLKRCCCLOCKTYPESYSCLK RCCCLOCKTYPEPCLKRCCCLOCKTYPEPCLK; RCCClkInitStruct.SYSCLKSource RCCSYSCLKSOURCEPLLCLK; RCCClkInitStruct.AHBCLKDivider RCCSYSCLKDIV; RCCClkInitStruct.APBCLKDivider RCCHCLKDIV; RCCClkInitStruct.APBCLKDivider RCCHCLKDIV; if HALRCCClockConfig&RCCClkInitStruct, FLASHLATENCY HALOK ErrorHandler; static void MXTIMInitvoid TIMMasterConfigTypeDef sMasterConfig ; htimInstance TIM; htimInit.Prescaler ; htimInit.CounterMode TIMCOUNTERMODEUP; htimInit.Period ; htimInit.AutoReloadPreload TIMAUTORELOADPRELOADDISABLE; if HALTIMBaseInit&htim HALOK ErrorHandler; sMasterConfig.MasterOutputTrigger TIMTRGORESET; sMasterConfig.MasterSlaveMode TIMMASTERSLAVEMODEDISABLE; if HALTIMExMasterConfigSynchronization&htim &sMasterConfig HALOK ErrorHandler; static void MXTIMInitvoid TIMMasterConfigTypeDef sMasterConfig ; htimInstance TIM; htimInit.Prescaler ; htimInit.CounterMode TIMCOUNTERMODEUP; htimInit.Period ; htimInit.AutoReloadPreload TIMAUTORELOADPRELOADDISABLE; if HALTIMBaseInit&htim HALOK ErrorHandler; sMasterConfig.MasterOutputTrigger TIMTRGORESET; sMasterConfig.MasterSlaveMode TIMMASTERSLAVEMODEDISABLE; if HALTIMExMasterConfigSynchronization&htim &sMasterConfig HALOK ErrorHandler; static void MXGPIOInitvoid GPIOInitTypeDef GPIOInitStruct ; GPIO Ports Clock Enable HALRCCGPIOCCLKENABLE; HALRCCGPIOACLKENABLE; Configure GPIO pin Output Level HALGPIOWritePinGPIOA GPIOPIN GPIOPINRESET; Configure GPIO pin Output Level HALGPIOWritePinGPIOC GPIOPIN GPIOPINRESET; Configure GPIO pin : PC GPIOInitStruct.Pin GPIOPIN; GPIOInitStruct.Mode GPIOMODEITRISING; GPIOInitStruct.Pull GPIOPULLUP; HALGPIOInitGPIOC &GPIOInitStruct; Configure GPIO pin : PA GPIOInitStruct.Pin GPIOPIN; GPIOInitStruct.Mode GPIOMODEOUTPUTPP; GPIOInitStruct.Pull GPIOPULLUP; GPIOInitStruct.Speed GPIOSPEEDFREQLOW; HALGPIOInitGPIOA &GPIOInitStruct; Configure GPIO pins : PA PA GPIOInitStruct.Pin GPIOPINGPIOPIN; GPIOInitStruct.Mode GPIOMODEITRISING; GPIOInitStruct.Pull GPIOPULLUP; HALGPIOInitGPIOA &GPIOInitStruct; Configure GPIO pin : PC GPIOInitStruct.Pin GPIOPIN; GPIOInitStruct.Mode GPIOMODEOUTPUTPP; GPIOInitStruct.Pull GPIOPULLUP; GPIOInitStruct.Speed GPIOSPEEDFREQLOW; HALGPIOInitGPIOC &GPIOInitStruct; EXTI interrupt init HALNVICSetPriorityEXTIIRQn, ; HALNVICEnableIRQEXTIIRQn; HALNVICSetPriorityEXTIIRQn, ; HALNVICEnableIRQEXTIIRQn; USER CODE BEGIN MXGPIOInit USER CODE END MXGPIOInit Declare static integers static int timerstatus ; static int timerstatus; Function called every time he counter fishes void HALTIMPeriodElapsedCallbackTIMHandleTypeDef htimIf timer status is blink iftimerstatus
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
