26 lines
628 B
C
26 lines
628 B
C
#include "Servo.h"
|
|
#include "DriverGPIO.h"
|
|
#include "PWM.h"
|
|
#include "Timer.h"
|
|
|
|
void Servo_Moteur(int angle, TIM_TypeDef * Timer, int Channel){ // Controle du moteur
|
|
int dutyCycle = (5* angle + 5*90)/90;
|
|
PWM_Set_DutyCycle(Timer, Channel, dutyCycle);
|
|
}
|
|
|
|
void initServo(TIM_TypeDef * Timer, int Channel){ // Config du moteur servo
|
|
if (Timer == TIM4) {
|
|
EnableTimer(TIM4);
|
|
MyTimer_Base_Init(TIM4, 20000 - 1, 71); //Claire m'a
|
|
if (Channel == 3){
|
|
MyGPIO_Init(GPIOB, 8, AltOut_Ppull);
|
|
}
|
|
else{
|
|
//printf("Cet pilôte n'existe pas");
|
|
}
|
|
}
|
|
else{
|
|
//printf("Cet pilôte n'existe pas");
|
|
}
|
|
}
|
|
|