43 lines
685 B
C
43 lines
685 B
C
#include "stm32f10x.h"
|
|
#include "GPIO.h"
|
|
#include "TIMER.h"
|
|
#include "MyI2C.h"
|
|
#include "MySPI.h"
|
|
#include "Rouli.h"
|
|
|
|
|
|
void Mafonction_IT (void);
|
|
MyGPIO_Struct_TypeDef PA5;
|
|
MyGPIO_Struct_TypeDef PC13;
|
|
MyTimer_Struct_TypeDef timer2;
|
|
//PA5 LED
|
|
//PC13 Bouton
|
|
char accel;
|
|
|
|
int main ( void )
|
|
{
|
|
PA5.GPIO=GPIOA;
|
|
PA5.GPIO_Conf=Out_Ppull;
|
|
PA5.GPIO_Pin=5;
|
|
MyGPIO_Init(&PA5);
|
|
timer2.Timer=TIM2;
|
|
timer2.ARR=35999; //pour avoir 500ms
|
|
timer2.PSC=1000;
|
|
MyTimer_Base_Init(&timer2);
|
|
MyTimer_ActiveIT(timer2.Timer,1, &Mafonction_IT);
|
|
MyTimer_Base_Start(timer2.Timer);
|
|
|
|
MySPI_Init(SPI1);
|
|
while(1)
|
|
{
|
|
accel = roulis();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Mafonction_IT (void)
|
|
{
|
|
MyGPIO_Toggle(PA5.GPIO,5);
|
|
}
|