Made platform_getVbat returning the battery voltage in V instead of mV.

replace/a056fe66d40072fc2dadaccbe607662afade7bad
Silvano Seva 2020-10-26 13:14:52 +01:00 zatwierdzone przez Niccolò Izzo
rodzic 50f6799ab9
commit 2350103831
3 zmienionych plików z 13 dodań i 3 usunięć

Wyświetl plik

@ -54,7 +54,7 @@ void platform_init();
void platform_terminate(); void platform_terminate();
/** /**
* This function reads and returns the current battery voltage. * This function reads and returns the current battery voltage in volt.
*/ */
float platform_getVbat(); float platform_getVbat();

Wyświetl plik

@ -118,7 +118,12 @@ void platform_terminate()
float platform_getVbat() float platform_getVbat()
{ {
return adc1_getMeasurement(0); /*
* Battery voltage is measured through an 1:3 voltage divider and
* adc1_getMeasurement returns a value in mV. Thus, to have effective
* battery voltage multiply by three and divide by 1000
*/
return adc1_getMeasurement(0)*3.0f/1000.0f;
} }
float platform_getMicLevel() float platform_getMicLevel()

Wyświetl plik

@ -85,7 +85,12 @@ void platform_terminate()
float platform_getVbat() float platform_getVbat()
{ {
return adc1_getMeasurement(0); /*
* Battery voltage is measured through an 1:3 voltage divider and
* adc1_getMeasurement returns a value in mV. Thus, to have effective
* battery voltage multiply by three and divide by 1000
*/
return adc1_getMeasurement(0)*3.0f/1000.0f;
} }
float platform_getMicLevel() float platform_getMicLevel()