Project restructuring (fixes macOS builds) (#198)
- Create `Include/` folder for all main projects - Fix some issues here and there (found while moving things) - All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
This commit is contained in:
committed by
GitHub
parent
7856827ecf
commit
c87200a80d
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::hal {
|
||||
|
||||
class Power{
|
||||
|
||||
public:
|
||||
|
||||
Power() = default;
|
||||
virtual ~Power() = default;
|
||||
|
||||
enum class MetricType {
|
||||
IsCharging, // bool
|
||||
Current, // int32_t, mAh - battery current: either during charging (positive value) or discharging (negative value)
|
||||
BatteryVoltage, // uint32_t, mV
|
||||
ChargeLevel, // uint8_t [0, 100]
|
||||
};
|
||||
|
||||
union MetricData {
|
||||
int32_t valueAsInt32 = 0;
|
||||
uint32_t valueAsUint32;
|
||||
uint8_t valueAsUint8;
|
||||
float valueAsFloat;
|
||||
bool valueAsBool;
|
||||
};
|
||||
|
||||
virtual bool supportsMetric(MetricType type) const = 0;
|
||||
|
||||
/**
|
||||
* @return false when metric is not supported or (temporarily) not available.
|
||||
*/
|
||||
virtual bool getMetric(Power::MetricType type, MetricData& data) = 0;
|
||||
|
||||
virtual bool supportsChargeControl() const { return false; }
|
||||
virtual bool isAllowedToCharge() const { return false; }
|
||||
virtual void setAllowedToCharge(bool canCharge) { /* NO-OP*/ }
|
||||
};
|
||||
|
||||
} // namespace tt
|
||||
Reference in New Issue
Block a user