Implement battery support for LilyGO T-HMI S3 (#511)
This commit is contained in:
committed by
GitHub
parent
2426c387eb
commit
9fc0aa51d7
@@ -1,10 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
#include <string>
|
||||
#include <esp_adc_cal.h>
|
||||
#include <driver/gpio.h>
|
||||
#include <ChargeFromVoltage.h>
|
||||
#include <Tactility/hal/power/PowerDevice.h>
|
||||
|
||||
constexpr auto THMI_S3_POWEREN_GPIO = GPIO_NUM_10;
|
||||
constexpr auto THMI_S3_POWERON_GPIO = GPIO_NUM_14;
|
||||
|
||||
std::shared_ptr<tt::hal::power::PowerDevice> createPower();
|
||||
using tt::hal::power::PowerDevice;
|
||||
|
||||
class Power final : public PowerDevice {
|
||||
|
||||
ChargeFromVoltage chargeFromAdcVoltage = ChargeFromVoltage(3.3f, 4.2f);
|
||||
bool initialized = false;
|
||||
esp_adc_cal_characteristics_t adcCharacteristics;
|
||||
bool calibrated = false;
|
||||
|
||||
bool adcInitCalibration();
|
||||
uint32_t adcReadValue() const;
|
||||
|
||||
bool ensureInitialized();
|
||||
|
||||
public:
|
||||
|
||||
std::string getName() const override { return "T-hmi Power"; }
|
||||
std::string getDescription() const override { return "Power measurement via ADC"; }
|
||||
|
||||
bool supportsMetric(MetricType type) const override;
|
||||
bool getMetric(MetricType type, MetricData& data) override;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user