diff --git a/MyDrivers/Timer.c b/MyDrivers/Timer.c index 023998d..2b29356 100644 --- a/MyDrivers/Timer.c +++ b/MyDrivers/Timer.c @@ -191,12 +191,12 @@ void PWMi_conf(TIM_TypeDef * TIMx, uint32_t channels){ //TIM_DIER_CC1DE_Pos; Probablement pas utile } -int get_input_period(TIM_TypeDef * TIMx) { +int PWMi_getPeriod(TIM_TypeDef * TIMx) { return TIMx -> CCR1; } -int get_input_duty_cycle(TIM_TypeDef * TIMx) { +int PWMi_getDutyCycle(TIM_TypeDef * TIMx) { return TIMx -> CCR2; } diff --git a/MyDrivers/Timer.h b/MyDrivers/Timer.h index cc484f7..800446c 100644 --- a/MyDrivers/Timer.h +++ b/MyDrivers/Timer.h @@ -59,9 +59,11 @@ void Timer_stop(TIM_TypeDef * timer); * PWM INPUT ***************************************************************************/ -void PWMi_conf(TIM_TypeDef * timer, int channel); +void PWMi_conf(TIM_TypeDef * timer, uint32_t channel); -int PWMi_getDutyCycle(TIM_TypeDef * timer, int channel); +int PWMi_getDutyCycle(TIM_TypeDef * timer); + +int PWMi_getPeriod(TIM_TypeDef * TIMx); /**************************************************************************** * PWM OUTPUT diff --git a/Services/Voltage.c b/Services/Voltage.c index e47b4a9..603852b 100644 --- a/Services/Voltage.c +++ b/Services/Voltage.c @@ -1 +1,21 @@ #include "Voltage.h" + + +void Voltage_conf() { + + //On configure le pin qui recevra le signal, ici PC2 + GPIO_conf(GPIOC, LL_GPIO_PIN_2, LL_GPIO_MODE_ANALOG, 0, 0); + + //On configure l'ADC + ADC_conf(ADC2, 12); + + //On démarre l'ADC + ADC_start(ADC2); + +} + +double Voltage_getVoltage() { + + ADC_readVolt(ADC2); + +} \ No newline at end of file diff --git a/Services/Voltage.h b/Services/Voltage.h index 141c358..ae8b4d2 100644 --- a/Services/Voltage.h +++ b/Services/Voltage.h @@ -1,4 +1,11 @@ #ifndef VOLTAGE_H #define VOLTAGE_H +#include "ADC.h" +#include "GPIO.h" + +void Voltage_conf(); + +double Voltage_getVoltage(); + #endif