Projet_voilier2/Projet_voile/Sources/Principal.c

38 lines
609 B
C

#include "stm32f10x.h"
#include "GPIO.h"
#include "TIMER.h"
#include "ADC.h"
#include "UART.h"
int val_adc=0;
MyGPIO_Struct_TypeDef PA5; //PA5 LED
MyGPIO_Struct_TypeDef PC13; //PC13 Bouton
MyTimer_Struct_TypeDef timer2;
MyADC_Struct_TypeDef myADC;
void Mafonction_IT (void);
void Mafonction_IT2(void);
int main ( void )
{
myADC.ADC=ADC1;
myADC.channel=2;
MyADC_init(&myADC);
MyADC_ActiveIT(myADC.ADC,0,&Mafonction_IT2);
MyADC_start_conversion(myADC.ADC);
while(1)
{
}
}
void Mafonction_IT (void)
{
MyGPIO_Toggle(PA5.GPIO,5);
}
void Mafonction_IT2 (void)
{
val_adc=MyADC_result(myADC.ADC);
}