40 行
621 B
C
40 行
621 B
C
#include "Driver_Timer.h"
|
|
#include "Driver_Timer.c"
|
|
#include "Driver_UART.h"
|
|
#include "Plateau.h"
|
|
#include "Driver_GPIO.h"
|
|
|
|
|
|
void Plateau_init(void)
|
|
{
|
|
MyTimer_Struct_TypeDef Timer;
|
|
MyGPIO_Struct_TypeDef Pin_Sens;
|
|
|
|
//Fréquence
|
|
Timer.Timer = TIM3;
|
|
Timer.ARR=3599;
|
|
Timer.PSC=0;
|
|
|
|
Pin_Sens.GPIO=GPIOB;
|
|
Pin_Sens.GPIO_Pin=1;
|
|
Pin_Sens.GPIO_Conf = Out_PullUp;
|
|
|
|
MyTimer_Base_Init(&Timer);
|
|
MyGPIO_Init(&Pin_Sens);
|
|
|
|
MyTimer_PWM(TIM3, 50);
|
|
|
|
MyTimer_Base_Start(Timer);
|
|
|
|
}
|
|
|
|
|
|
void MyMotor_ChangeDirection(uint8_t Sens)
|
|
{
|
|
if(Sens == DROITE)
|
|
MyGPIO_Set(GPIOB,1);
|
|
if (Sens == GAUCHE)
|
|
MyGPIO_Reset(GPIOB,1);
|
|
|
|
}
|
|
|