HAL renaming & relocation (#215)
Implemented more consistent naming: - Moved all HAL devices into their own namespace (and related folder) - Post-fixed all HAL device names with "Device"
This commit is contained in:
committed by
GitHub
parent
a7a3b17ff6
commit
2345ba6d13
@@ -0,0 +1,44 @@
|
||||
#pragma once
|
||||
|
||||
#include "../Device.h"
|
||||
#include <cstdint>
|
||||
|
||||
namespace tt::hal::power {
|
||||
|
||||
class PowerDevice : public Device {
|
||||
|
||||
public:
|
||||
|
||||
PowerDevice() = default;
|
||||
~PowerDevice() override = default;
|
||||
|
||||
Type getType() const override { return Type::Power; }
|
||||
|
||||
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(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