rak3x72 : report bat voltage
This commit is contained in:
@@ -8,11 +8,19 @@
|
|||||||
#include <helpers/ArduinoHelpers.h>
|
#include <helpers/ArduinoHelpers.h>
|
||||||
#include <helpers/SensorManager.h>
|
#include <helpers/SensorManager.h>
|
||||||
|
|
||||||
|
#define PIN_VBAT_READ A0
|
||||||
|
#define ADC_MULTIPLIER (5 * 1.73 * 1000)
|
||||||
|
|
||||||
class RAK3x72Board : public STM32Board {
|
class RAK3x72Board : public STM32Board {
|
||||||
public:
|
public:
|
||||||
const char* getManufacturerName() const override {
|
const char* getManufacturerName() const override {
|
||||||
return "RAK 3x72";
|
return "RAK 3x72";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t getBattMilliVolts() override {
|
||||||
|
uint32_t raw = analogRead(PIN_VBAT_READ);
|
||||||
|
return (ADC_MULTIPLIER * raw) / 1024;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RAK3x72Board board;
|
extern RAK3x72Board board;
|
||||||
|
|||||||
Reference in New Issue
Block a user