mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-02-18 19:03:16 +00:00
- Updated all boards to use `hal::Configuration.createDevices` - Updated all boards to use new directory structure and file naming convention - Refactored `Xpt2046SoftSpi` driver. - Created `Axp2101Power` device in `Drivers/AXP2101` - Removed global static instances from some drivers (instances that kept a reference to the Device*) - Improved `SystemInfoApp` UI: better memory labels, hide external memory bar when there's no PSRAM - Fix for HAL: register touch devices after displays are registered - Fix for Boot splash hanging on WiFi init: unlock file lock after using it
29 lines
791 B
C++
29 lines
791 B
C++
#pragma once
|
|
|
|
#include <Tactility/hal/power/PowerDevice.h>
|
|
|
|
class Xpt2046Touch;
|
|
using tt::hal::power::PowerDevice;
|
|
|
|
/**
|
|
* Power management based on the voltage measurement at the LCD panel.
|
|
* This estimates the battery power left.
|
|
*/
|
|
class Xpt2046Power : public PowerDevice {
|
|
|
|
std::shared_ptr<Xpt2046Touch> xptTouch;
|
|
|
|
bool readBatteryVoltageOnce(uint32_t& output);
|
|
bool readBatteryVoltageSampled(uint32_t& output);
|
|
|
|
public:
|
|
|
|
~Xpt2046Power() override = default;
|
|
|
|
std::string getName() const final { return "XPT2046 Power Measurement"; }
|
|
std::string getDescription() const final { return "Power interface via XPT2046 voltage measurement"; }
|
|
|
|
bool supportsMetric(MetricType type) const override;
|
|
bool getMetric(MetricType type, MetricData& data) override;
|
|
};
|