Complete proxy functions in Power.h and refactor (mainly reorder) for clarity.
This commit is contained in:
@@ -18,33 +18,52 @@ class Power {
|
||||
public:
|
||||
static void begin(void);
|
||||
Power();
|
||||
uint16_t getFreeCurrentBudget(void);
|
||||
/// @brief Request an allowance of a certain number of milliwatts from the
|
||||
/// power scheduler
|
||||
/// @param neededPower the amount of power we want to be accounted for (in mW)
|
||||
/// @return whether the power could be successfully allocated
|
||||
static bool
|
||||
tryAccquireCurrentAllowance(PowerParameters::PowerConsumers consumer,
|
||||
uint16_t neededCurrent,
|
||||
uint16_t requestedDurationMs);
|
||||
/// @brief "Return" the power consumed by an active consumer
|
||||
/// @param neededPower the amount of power to return (in mW)
|
||||
/// @return whether the power
|
||||
/// @brief Get the current free current budget (to C1 discharge)
|
||||
/// @return the amount of power that is currently available (in mA)
|
||||
static float getFreeLimitCurrentBudget(void);
|
||||
/// @brief Get the current hard maximum free current (to C2 discharge)
|
||||
/// @return the maximum amount of power that can be allocated (in mA)
|
||||
static float getFreeMaximumCurrentBudget(void);
|
||||
|
||||
/// @brief Request an allowance of a certain number of milliamperes from the
|
||||
/// power scheduler without waiting for it (meaning it will not be scheduled
|
||||
/// for future allocation). Only one can be active per consumer.
|
||||
/// @param neededCurrent the amount of current we want to be accounted for (in
|
||||
/// mA)
|
||||
/// @return whether the current could be successfully allocated
|
||||
static bool tryAccquireCurrentAllowance(PowerParameters::PowerConsumers consumer,
|
||||
uint16_t neededcurrent,
|
||||
uint16_t requestedDurationMs = 0);
|
||||
/// @brief "Return" the current currently allocated to a consumer
|
||||
/// @param consumer the active consumer to release the current for
|
||||
static void releaseCurrent(PowerParameters::PowerConsumers consumer);
|
||||
|
||||
/// @brief Wait for a certain amount of power to be available
|
||||
/// @param neededPower the amount of power we want to be accounted for (in mW)
|
||||
/// @brief Wait for a certain amount of current to be available. This will
|
||||
/// "reseve a spot in the queue". Only one can be active per consumer.
|
||||
/// @param neededCurrent the amount of power we want to be accounted for (in
|
||||
/// mW)
|
||||
/// @param TicksToWait the amount of time to wait for the power to become
|
||||
/// available
|
||||
/// @return whether the power could be successfully allocatedy
|
||||
static bool waitForCurrentAllowance(PowerParameters::PowerConsumers consumer,
|
||||
uint16_t neededCurrent,
|
||||
TickType_t TicksToWait,
|
||||
uint16_t requestedDurationMs);
|
||||
uint16_t neededCurrent,
|
||||
uint16_t maxSlackTimeMs,
|
||||
uint16_t requestedDurationMs);
|
||||
/// @brief Put the ESP32 into deep sleep mode, without a method to wake up
|
||||
/// again. Basically this is a shutdown.
|
||||
static void beginPermanentDeepSleep(void);
|
||||
|
||||
//// @brief Get currently granted power
|
||||
/// @return the amount of power that is currently allocated (in mA)
|
||||
static float getCurrentCurrent(void);
|
||||
|
||||
// @brief Responsible for recalculating the current budgets
|
||||
static void recalculateCurrentBudgets(void);
|
||||
|
||||
// @brief Get current consumption of a consumer
|
||||
static float getConsumerCurrent(PowerParameters::PowerConsumers consumer);
|
||||
|
||||
|
||||
/// @brief Get battery voltage measurement.
|
||||
/// @return Battery Terminal Voltage in Volts
|
||||
static float getBatteryVoltage();
|
||||
|
||||
Reference in New Issue
Block a user