Periph-Voilier/Services/MyRF.c
2020-11-22 18:22:41 +01:00

38 lines
836 B
C

#include "MyRF.h"
#include "MyTimer.h"
#include "MyPWM.h"
#include "stm32f1xx_ll_bus.h" // Pour l'activation des horloges
#include "stm32f1xx_ll_tim.h"
#include "stm32f1xx_ll_gpio.h"
void MyRF_Conf(void) {
//Initialisation du GPIO
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_GPIOB);
LL_GPIO_InitTypeDef My_GPIO_Init_Struct;
LL_GPIO_StructInit(&My_GPIO_Init_Struct);
//PB.6 en floating input
My_GPIO_Init_Struct.Pin = PinCH1;
LL_GPIO_Init(GPIOB, &My_GPIO_Init_Struct);
//PB.7 en floating input
My_GPIO_Init_Struct.Pin = PinCH2;
LL_GPIO_Init(GPIOB, &My_GPIO_Init_Struct);
MyTimer_Conf(TimerCC,0xFFAD,0x15);
MyPWM_Conf_Input(TimerCC, channelCC1, channelCC2);
MyTimer_Start(TimerCC);
}
int MyRF_Input_Duty_Cycle(void) {
return (MyPWM_Duty_Cycle_Permilles(TimerCC, channelCC1, channelCC2) - 75) * 4;
}