51 lines
594 B
C
51 lines
594 B
C
#include "stm32f10x.h"
|
|
#include <Driver_GPIO.h>
|
|
#include <MyTimer.h>
|
|
#include <MyADC.h>
|
|
|
|
int a ;
|
|
|
|
void Callback(void){
|
|
startADC();
|
|
a=read();
|
|
}
|
|
|
|
|
|
int main (void)
|
|
{
|
|
//char channel = 1;
|
|
|
|
// Configuration du timer
|
|
MyTimer_Struct_TypeDef TIM;
|
|
MyTimer_Struct_TypeDef * Data = &TIM;
|
|
Data->Timer = TIM2;
|
|
Data->ARR = 65535;
|
|
Data->PSC = 548;
|
|
MyTimer_Base_Init(Data);
|
|
|
|
//MyTimer_PWM(Data->Timer, channel);
|
|
|
|
|
|
|
|
// Set_PWM_PRCT(Data->Timer, channel, 20);
|
|
|
|
|
|
|
|
initADC(1);
|
|
|
|
|
|
|
|
|
|
MyTimer_ActiveIT ( TIM2 , 1, &Callback);
|
|
|
|
MyTimer_Base_Start(TIM2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
do {
|
|
}
|
|
while (1);
|
|
}
|