#include "stm32f10x.h" #include "../../Drivers/gpiodriver.h" #include "../../Drivers/timerdriver.h" void ToggleLed(void) { MyGPIO_Toggle(GPIOA,5); } int main (void) { MyGPIO_Struct_TypeDef led = {GPIOA,5,Out_PullUp}; //led MyTimer_Struct_TypeDef timer2 = {TIM2,499,7199}; //timer //init & start LED, PWM, Timer MyGPIO_Init(&led); MyTimer_Base_Init(&timer2); MyTimer_Base_Start(TIM2); //Init Interruption & Activate Init_Periph(ToggleLed); MyTimer_ActiveIT(TIM2,2); //PWM enable MyPWM_Struct_TypeDef PWMTIM2 = {TIM2,3,400}; //creation of PWM MyTimer_PWM_Init(&PWMTIM2); //Init useful registers MyGPIO_Struct_TypeDef gpioPWMTIM2 = GPIOFromPWM(PWMTIM2); //Returns the GPIO from the given PWM (Timer + Channel) MyGPIO_Init(&gpioPWMTIM2); //Init the GPIO MyPWM_Base_Start(TIM2); //STart the TIMER do{ }while(1) ; }