#include "stm32f10x.h" #include "GPIO.h" #include "TIMER.h" #include "MyI2C.h" #include "MySPI.h" #include "Rouli.h" #include void Mafonction_IT (void); MyGPIO_Struct_TypeDef PA5; MyGPIO_Struct_TypeDef PC13; MyTimer_Struct_TypeDef timer2; //PA5 LED //PC13 Bouton char X0,X1,Y0,Y1,Z0,Z1; char read_DATA,read_BWR,read_PWRC; int16_t gX,gY,gZ; XYZ mesures; 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); rouli_InitAccel(); MySPI_Send(READ|DATA_FORMAT); read_DATA = MySPI_Read(); MySPI_Send(READ|BW_RATE); read_BWR = MySPI_Read(); MySPI_Send(READ|POWER_CTL); read_PWRC = MySPI_Read(); while(1) { rouli_GetAccel(&mesures); //printf("%f, %f, %f\n",mesures.gX,mesures.gY,mesures.gZ); } return 0; } void Mafonction_IT (void) { MyGPIO_Toggle(PA5.GPIO,5); }