projet_voilier/Services/Voltage.c
2020-11-13 08:49:00 +01:00

21 lines
398 B
C

#include "Voltage.h"
void Voltage_conf(ADC_TypeDef * adc, GPIO_TypeDef * gpio, int pin)
{
//On configure le pin qui recevra le signal, ici PC2
GPIO_conf(gpio, pin, LL_GPIO_MODE_ANALOG, 0, 0);
//On configure l'ADC
ADC_conf(adc);
}
void Voltage_start(ADC_TypeDef * adc)
{
ADC_start(adc);
}
float Voltage_getVoltage(ADC_TypeDef * adc, int channel)
{
return ADC_readVolt(adc, channel);
}