41 lines
595 B
C
41 lines
595 B
C
#include "stm32f10x.h"
|
|
#include "Driver_GPIO.h"
|
|
#include "Driver_MyTimer.h"
|
|
|
|
void TIM2_IRQHandler (void)
|
|
{
|
|
MyGPIO_Toggle(GPIOC,13);
|
|
TIM2->SR &= ~TIM_SR_UIF;
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
int test;
|
|
MyTimer_Struct_TypeDef Test_TIM2 = {TIM2,5000,7200};
|
|
MyGPIO_Struct_TypeDef Bouton_13;
|
|
|
|
//Init bouton
|
|
|
|
Bouton_13.GPIO=GPIOC;
|
|
Bouton_13.GPIO_Pin=13;
|
|
Bouton_13.GPIO_Conf=Out_Ppull;
|
|
MyGPIO_Init(&Bouton_13);
|
|
|
|
//Init TIM2
|
|
MyTimer_Base_Init(&Test_TIM2);
|
|
// init IT TIM2
|
|
MyTimer_ActiveIT(Test_TIM2.Timer,0);
|
|
|
|
|
|
// lance le timer
|
|
MyTimer_Base_Start(TIM2);
|
|
do
|
|
{
|
|
|
|
|
|
}while(1);
|
|
|
|
|
|
}
|
|
|
|
|