#ifndef __TIMER_H
#define __TIMER_H

#include "stm32f10x.h"

typedef uint32_t clock_time_t;
#define CLOCK_CONF_SECOND 10
#define CLOCK_SECOND CLOCK_CONF_SECOND
extern uint32_t time_value;					//¼ÆÊ±Æ÷Öµ


typedef struct _timer {
  clock_time_t start;
  clock_time_t interval;
}timer;

void timer_set(timer *t, clock_time_t interval);
void timer_reset(timer *t);
void timer_restart(timer *t);
int timer_expired(timer *t);
uint32_t timer_remaining(timer *t);

void TIM2_Int_Init(u16 arr,u16 psc); 

// void TIM2_Int_Init(u16 arr,u16 psc);
void TIM3_Int_Init(u16 arr,u16 psc);
void TIM3_Period_Reset(u16 arr);

void TIM4_Int_Init(u16 arr,u16 psc);
void TIM5_Int_Init(u16 arr,u16 psc);

void TIM6_Int_Init(u16 arr,u16 psc);
 
#endif
