voilier-team-1/keilproject/Source/Principale.c

39 lines
866 B
C
Raw Normal View History

2023-03-22 15:28:54 +01:00
#include "stm32f10x.h"
#include "../../driver/MyI2C.h"
#include "../../driver/MySPI.h"
#include "../../driver/timer.h"
#include "../../driver/gpio.h"
2023-03-22 15:28:54 +01:00
void Girouette_Angle(void);
int Angle_Girouette=0;
2023-03-22 15:28:54 +01:00
int main (void)
{
2023-04-07 15:33:22 +02:00
//configuration gpiob6 et gpiob7 en entr<74>es pull up
MyGPIO_Struct_TypeDef MyGPIO={GPIOB,6,In_PullUp};
MyGPIO_Init(&MyGPIO);
2023-04-07 15:33:22 +02:00
MyGPIO.GPIO_Pin=7;
MyGPIO_Init(&MyGPIO);
2023-04-07 15:33:22 +02:00
//configuration TIM4 reset a 360
MyTimer_Struct_Typedef MyTimerGirouette ={TIM4,359,1};
MyTimer_Base_Init(&MyTimerGirouette);
2023-04-07 15:33:22 +02:00
TIM4->SMCR &=~0x07;
TIM4->SMCR |=~0x011;
TIM4->CCMR1 |= TIM_CCMR1_CC1S_0;
TIM4->CCMR1 |= TIM_CCMR1_CC2S_0;
TIM4->CCER &=~TIM_CCER_CC1P;
TIM4->CCER &=~TIM_CCER_CC1NP;
TIM4->CCER &=~TIM_CCER_CC2P;
TIM4->CCER &=~TIM_CCER_CC2NP;
TIM4->CCMR1&=~TIM_CCER_IC1F;
TIM1->CR1 |= 1;
Angle_Girouette=TIM4->CNT;
2023-03-22 15:28:54 +01:00
while(1){};
}