21 lines
317 B
C
21 lines
317 B
C
#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() {
|
|
|
|
return ADC_readVolt(ADC2);
|
|
|
|
}
|