49 lines
747 B
C
49 lines
747 B
C
#include "stm32f10x.h"
|
|
#include "GPIO.h"
|
|
#include "TIMER.h"
|
|
|
|
|
|
|
|
void MyFunction_IT (void);
|
|
MyGPIO_Struct_TypeDef PA5;
|
|
MyGPIO_Struct_TypeDef PA6;
|
|
MyGPIO_Struct_TypeDef PC13;
|
|
MyTimer_Struct_TypeDef timer3;
|
|
//PA5 LED
|
|
//PC13 Bouton
|
|
|
|
int main ( void )
|
|
{
|
|
PA5.GPIO=GPIOA;
|
|
PA5.GPIO_Conf=Out_Ppull;
|
|
PA5.GPIO_Pin=5;
|
|
MyGPIO_Init(&PA5);
|
|
PA6.GPIO=GPIOA;
|
|
PA6.GPIO_Conf=AltOut_Ppull;
|
|
PA6.GPIO_Pin=6;
|
|
MyGPIO_Init(&PA6);
|
|
|
|
timer3.Timer=TIM3;
|
|
timer3.ARR=35999; //pour avoir 500ms
|
|
timer3.PSC=1000;
|
|
MyTimer_Base_Init(&timer3);
|
|
MyTimer_ActiveIT(timer3.Timer,1, &MyFunction_IT);
|
|
MyTimer_Base_Start(timer3.Timer);
|
|
|
|
MyPWM_init (TIM3,1);
|
|
MyPWM_Duty (TIM3,1, 10000);
|
|
|
|
|
|
while(1)
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void MyFunction_IT (void)
|
|
{
|
|
MyGPIO_Toggle(PA5.GPIO,5);
|
|
}
|